There are two approaches that can be used to connect MySQL and PHP code, which are mentioned below. Let's get to know both of these options a bit more. A Database Abstraction Layer is the PHP Data Objects (PDO) extension.
PDO will work on 12 different database systems, whereas MySQLi will only work with MySQL databases. So, if you have to switch your project to use another database, PDO makes the process easy.